import Request from '@/utils/request'	
import mockRequest from '@/utils/mockRequest'	

//--真实的接口--------------------
// 获取菜单导航
export const getCatagoryList = ()=>{
	return Request({
    	method:'GET',
    	url:'/product/getBaseCategoryList',
  	})
}
//获取商品列表
export const getCommdityList = (data)=>{
	return Request({
    	method:'POST',
    	url:'/list',
    	data
  	})
}
// 获取单个商品
// 注意query是一个字符串！！
export const getCommdityDetail= (query) =>{
	return Request({
		method:'GET',
		url:`/item/${query}`,
	})
}
//添加购物车 或 修改购物车
export const addShopCart = (skuId,skuNum) =>{
	return Request({
		method:'POST',
		url:`/cart/addToCart/${skuId}/${skuNum}`
	})
}
//获取购物车信息
export const getCartInfo = () =>{
	return Request({
		method:'GET',
		url:`/cart/cartList`
	})
}
//删除购物车商品
export const delCartCommdity = (skuId) =>{
	return Request({
		method:'DELETE',
		url:`/cart/deleteCart/${skuId}`
	})
}
//购物车商品选中状态
export const checkedCartCommdity = (skuID,isChecked) =>{
	return Request({
		method:'GET',
		url:`/cart/checkCart/${skuID}/${isChecked}`
	})
}
//登录接口
export const login = (data) =>{
	return Request({
		method:'POST',
		url:`/user/passport/login`,
		data
	})
}





//--模拟的接口--------------------
// 轮播图数据
export const getBanner = ()=>{
	return mockRequest({
    	method:'GET',
    	url:'/banner',
  	})
}
// 楼层数据
export const getFloor = ()=>{
	return mockRequest({
    	method:'GET',
    	url:'/floor',
  	})
}